<!doctype html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>Eloquent JavaScript :: Errata</title>
  <link rel=stylesheet href="css/ejs.css">

  <style>
  </style>
</head>

<article>

<h1>Errata<div style="font-size: 70%"><a class="subtlelink" href="index.html">Eloquent JavaScript</a>, 3rd Edition</div></h2>

<p>These are the known mistakes in the <strong>third edition</strong>
of the book. For errata in the first edition,
see <a href="https://eloquentjavascript.net/1st_edition/errata.html">this
page</a>. For the second edition,
see <a href="https://eloquentjavascript.net/2nd_edition/errata.html">this
page</a>. To report a problem that is not listed
here, <a href="mailto:marijnh@gmail.com">send me an email</a>.</p>

<p>Issues whose page number is followed by an ordinal number are only
present up to the print denoted by that number. I.e. those followed by
“1st” were fixed in the second print.</p>

<h2>Chapter 2</h2>

<p><strong>Page 34</strong> (1st) <em>Updating Bindings Succintly</em>: Where it
says <code>counter-</code> it should be <code>counter--</code>.</p>

<h2>Chapter 5</h2>

<p><strong>Page 91</strong> (3rd) <em>Composability</em>: Due to an initial
mistake in the script data set, the results of the computations on
this page differ from the ones with the current, corrected data. The
average year for living scripts should be 1165, the average for
non-living scripts should be 204.</p>

<h2>Chapter 6</h2>

<p><strong>Page 111</strong> (2nd) <em>Inheritance</em>: In the second
paragraph below the example code, instead of “<code>content</code>
method”, the text should say “<code>element</code> function”.

<h2>Chapter 8</h2>

<p><strong>Page 134</strong> (2nd) <em>Error Propagation</em>: In the third
paragraph of the section, a function <code>promptInteger</code> is
referred to. The function is actually
called <code>promptNumber</code>, and the word “whole” should be
dropped from the sentence (it accepts non-whole numbers, too).</p>

<h2>Chapter 10</h2>

<p><strong>Page 168</strong> (1st) <em>Modules as Building Blocks</em>: In “each
needs it own private scope“, it should say “<em>its</em> own private
scope“.</p>

<h2>Chapter 11</h2>

<p><strong>Page 189/190</strong> (4th) <em>Networks are Hard</em>: The text
under the code that defines <code>request</code> claims the function
will give up after four attempts and a second. In fact, it gives up
after three attempts, in three-quarter second.</p>

<h2>Chapter 14</h2>

<p><strong>Page 231</strong> (5th) <em>Moving Through the Tree</em>: Below
the code example, the text claims
that <code>for</code>/<code>of</code> loops don't work on DOM child
lists. But in current (even as of the book's release) browsers they
do.</p>

<p><strong>Page 234</strong> (2nd) <em>Creating Nodes</em>: In the
code, “edition” is misspelled as “editon”.</p>

<h2>Chapter 15</h2>

<p><strong>Page 255</strong> (7th) <em>Mouse Motion</em>: The second
paragraph on the page claims that you can isolate a button from
the <code>buttons</code> bitmask with the remainder operator, but that
doesn't really work (you'd also need a division and a floor, which
gets too obscure to go into in this chapter).</p>

<p><strong>Page 258</strong> (3rd) <em>Load Event</em>: The description of
the <code>beforeunload</code> claims that you just need to return a
string from your event handler. For handlers registered
with <code>addEventListener</code> you, in fact, need to
call <code>preventDefault</code> and set a <code>returnValue</code>
property to get the warn-on-leave behavior.</p>

<h2>Chapter 16</h2>

<p><strong>Page 271</strong> (8th) <em>Actors</em>: Near the bottom of the
page, the book incorrectly uses the term <em>phase</em> (of a sinus
wave) where it should say <em>period</em>.</p>

<p><strong>Page 278</strong> (8th) <em>Motion and Collision</em>: The code
that defines the <code>touches</code> method unintentionally (though
harmlessly) used <code>var</code> instead of <code>let</code> to
define variables.</p>

<p><strong>Page 285</strong> (2nd) <em>Pausing the Game</em>: The text
refers to the <code>arrow</code> binding, where it should
say <code>arrowKeys</code>.</p>

<h2>Chapter 19</h2>

<p><strong>Page 336</strong> (5th) <em>The State</em>: The text mentions the
property <code>fillColor</code> where it should
say <code>fillStyle</code> instead.

<h2>Chapter 20</h2>

<p><strong>Page 367</strong> <em>A File Server</em>: The part that
talks about “the output stream to the request” should say “the stream
from the request” instead.</p>

<p><strong>Page 369</strong> (1st) <em>Directory
Creation</em>: <code>MKCOL</code> stands for “make collection”, not “make
column” as the book claims.</p>

<h2>Chapter 21</h2>

<p><strong>Page 373</strong> (3rd) <em>HTTP Interface</em>: There is a
superfluous closing brace at the end of the example JSON snippet.</p>

<h2>Exercise Hints</h2>

<p><strong>Page 414</strong> (3rd) <em>A Modular Robot</em>:
The <code>dijkstrajs</code> package name is misspelled
as <code>dijkstajs</code>.

</article>
